import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int length = str.length();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < length; i++) {
            char ch = str.charAt(i);
            if (stack.isEmpty()) {
                stack.push(ch);//如果栈为空直接
            } else {
                if (stack.peek() == ch) {
                    stack.pop();
                } else {
                    stack.push(ch);
                }
            }
        }
        Stack<Character> stack2 = new Stack<>();
        while (!stack.isEmpty()) {
            stack2.push(stack.pop());
        }

        StringBuilder ret = new StringBuilder();
        if (stack2.isEmpty()) {
            System.out.println(0);
        } else {
            while (!stack2.isEmpty()) {
                ret.append(stack2.pop());
            }
        }

        System.out.println(ret);
    }
}